import requests


def spider():
    url = "https://search.bilibili.com/all"
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
    }
    params = {
        "keyword": "半岛的孤城",
        # totalrank：综合排序，click:最多点击，pubdate：最新发布，dm：最多弹幕，stow：最多收藏
        "order": "pubdate",
        "duration": "0",
        "tids_1": "0",
    }
    response = requests.get(url=url, params=params, headers=headers).content.decode()

    print(response)


if __name__ == "__main__":
    spider()
    print("over!")
